58 #ifndef PROTOCOL_H_INCLUDED 59 #define PROTOCOL_H_INCLUDED 91 #define PROTOCOL_STATUS_OK 0x0000 93 #define PROTOCOL_STATUS_DEVICE_TIMEOUT 0x0001 97 #define PROTOCOL_STATUS_DEVICE_BAD_MESSAGE_START 0x0002 100 #define PROTOCOL_STATUS_DEVICE_BAD_ENDPOINT_ID 0x0003 104 #define PROTOCOL_STATUS_DEVICE_NO_PAYLOAD 0x0005 107 #define PROTOCOL_STATUS_DEVICE_OUT_OF_MEMORY 0x0006 111 #define PROTOCOL_STATUS_DEVICE_BAD_PAYLOAD_END 0x0007 115 #define PROTOCOL_STATUS_DEVICE_BAD_COMMAND 0xFFFF 139 #define PROTOCOL_ERROR_INVALID_HANDLE -1 149 #define PROTOCOL_ERROR_COULD_NOT_OPEN_COM_PORT -100 152 #define PROTOCOL_ERROR_DEVICE_NOT_COMPATIBLE -101 161 #define PROTOCOL_ERROR_RECEIVED_NO_MESSAGE -1000 164 #define PROTOCOL_ERROR_RECEIVED_TIMEOUT -1001 169 #define PROTOCOL_ERROR_RECEIVED_BAD_MESSAGE_START -1002 173 #define PROTOCOL_ERROR_RECEIVED_BAD_MESSAGE_END -1003 180 #define PROTOCOL_ERROR_ENDPOINT_DOES_NOT_EXIST -2000 183 #define PROTOCOL_ERROR_ENDPOINT_WRONG_TYPE -2001 187 #define PROTOCOL_ERROR_ENDPOINT_VERSION_TOO_OLD -2002 192 #define PROTOCOL_ERROR_ENDPOINT_VERSION_TOO_NEW -2003 221 uint16_t version_major;
222 uint16_t version_minor;
223 uint16_t version_build;
240 const char* description;
400 int32_t status_code);
int32_t protocol_do_firmware_reset(int32_t protocol_handle)
This function triggers a firmware reset of the connected device.
int32_t protocol_poll_receive_once(int32_t protocol_handle)
int32_t protocol_get_num_endpoints(int32_t protocol_handle)
This function returns the number of endpoints in the connected device.
This structure contains information about an endpoint.
int32_t protocol_get_endpoint_info(int32_t protocol_handle, uint8_t endpoint, Endpoint_Info_t *endpoint_info)
This function returns information about the requested endpoint.
int32_t protocol_connect(const char *port_name)
This function establishes a connection to a device through a COM port.
void protocol_disconnect(int32_t protocol_handle)
This function closes an open connection.
int32_t protocol_get_firmware_information(int32_t protocol_handle, Firmware_Information_t *information)
This function returns the information about the firmware of the connected device.
const char * protocol_get_status_code_description(int32_t protocol_handle, int32_t status_code)
This function returns a human readable description of a status or error code.